import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import viteCompression from 'vite-plugin-compression'
import { visualizer } from 'rollup-plugin-visualizer'
// https://vite.dev/config/
export default defineConfig({ 
  build:{
    chunkSizeWarningLimit: 1024 * 1024,
    rollupOptions:{
      output:{
        manualChunks:{
           vue:['vue'],
           echarts:['echarts'],
           '@kjgl77/datav-vue3':['@kjgl77/datav-vue3'],
        },
      }
    } 
  },
  plugins:[
    vue(),
    viteCompression({
      verbose: true,
      disable: false,
      deleteOriginFile: false,
      threshold: 10240,
      algorithm: 'gzip',
      ext: '.gz',
    }),
    viteCompression({
      verbose: true,
      disable: false,
      deleteOriginFile: false,
      threshold: 10240,
      algorithm: 'brotliCompress',
      ext: '.br',
    }),
    visualizer({
      open:true 
    })
  ]
})
